package javax.microedition.media;

import android.media.AudioManager;

import javax.microedition.media.control.VolumeControl;
import javax.microedition.midlet.MIDlet;

public class AndroidVolumeControl implements VolumeControl {
	protected static int lastLevel = 100;
	private AudioManager audioManager;
	private int maxVolume;

	public AndroidVolumeControl() {
		// AudioManager localAudioManager =
		// GameActivity.instance.getAudioManager();
		// this.audioManager = localAudioManager;
		int i = this.audioManager.getStreamMaxVolume(3);
		this.maxVolume = i;
	}

	public int getLevel() {
		return this.audioManager.getStreamVolume(3);
	}

	public boolean isMuted() {
		if (getLevel() == 0) {
			return true;
		} else {
			return false;
		}
	}

	public int setLevel(int paramInt) {
		int i = 3;
		int j = this.audioManager.getStreamVolume(i);
		if (j != 0)
			lastLevel = j;
		int k = this.maxVolume;
		if (paramInt >= k)
			paramInt = this.maxVolume;
		this.audioManager.setStreamVolume(i, paramInt, 16);
		return paramInt;
	}

	public void setMute(boolean paramBoolean) {
	}
}